home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / nghelp.zip / HELPSTRT.PAS < prev    next >
Pascal/Delphi Source File  |  1992-11-06  |  2KB  |  113 lines

  1. {$A+,B-,E+,F-,I+,N-,O-,R-,V-}
  2. {$DEFINE DEBUG}
  3. {$IFDEF DEBUG} {$D+,L+,S+} {$ELSE} {$D-,L-,S-} {$ENDIF}
  4. Unit HelpStrt;
  5.  
  6. Interface
  7.  
  8. Uses YNSystem,YNCrt,NG,Window,StrInt,Help_Var,NGCL,SwapVars;
  9.  
  10.  
  11. Procedure KeyBoardTask;
  12. Procedure CheckParam;
  13. Procedure CheckError(Error : TSRError);
  14.  
  15.  
  16. Implementation
  17.  
  18.  
  19. Procedure KeyBoardTask;
  20. Label TheEnd;
  21. Var K : Word;
  22. Begin
  23.  SaveAll;
  24.  
  25.  if (Lo(LastMode) In [CO40,BW40]) then
  26.   Begin
  27.    Sound(1000);
  28.    Delay(200);
  29.    NoSound;
  30.    Goto TheEnd;
  31.   End;
  32.  
  33. {$IFDEF TSR}
  34.  StartNG;
  35. {$ELSE}
  36.  StartNG;
  37. {$ENDIF}
  38.  
  39. TheEnd:
  40.  RestoreAll;
  41. End;
  42.  
  43.  
  44. Procedure CheckParam;
  45. Var Loop   : Byte;
  46.     P      : String[80];
  47.     Num    : Word;
  48.     PError : Pointer;
  49.     Error  : Word Absolute PError;
  50. Begin
  51.  FirstToDisk := KeepInMemory(0); { Default 0 kb in memory }
  52.  
  53.  For Loop := 1 to ParamCount Do
  54.   Begin
  55.    P := UpStr(ParamStr(Loop));
  56.    if (P='/?') Or (P='/H') then
  57.     Begin
  58.      Writeln;
  59.      Writeln('/? /H  Displays this help messages');
  60.      Writeln('/1   Leave only small portion resident');
  61.      Writeln('/2   Swap heap to disk');
  62.      Writeln('/3   Don''t swap anything to disk');
  63.      Writeln('/Mxx Keep xx kb in memory');
  64.      Writeln('/D   Alternatief path for swap files');
  65.      Writeln('/U   Remove HELP from memory');
  66.      Halt;
  67.     End;
  68.  
  69.    if P='/1' then FirstToDisk := FirstToSwap;
  70.    if P='/2' then FirstToDisk := HeapOrg;
  71.    if P='/3' then FirstToDisk := TopOfProgram;
  72.    if P='/U' then
  73.     Begin
  74.      PError := CALLTSR(Signature,ReleaseTSR);
  75.      if Error<>0 then Writeln(HelpName+': Couldn''t remove from memory')
  76.       Else Writeln(HelpName+': Succesfully removed from memory');
  77.      Halt;
  78.     End;
  79.  
  80.    if Copy(P,1,2)='/M' then
  81.     Begin
  82.      Val(Copy(P,3,4),Num,Error);
  83.      if Error=0 then
  84.       Begin
  85.        FirstToDisk := KeepInMemory(Num);
  86.       End;
  87.     End;
  88.    if Copy(P,1,2)='/D' then
  89.     Begin
  90.      SwpPath := Copy(P,3,255);
  91.      if (Length(SwpPath)>3) And (SwpPath[Length(SwpPath)]<>'\') then
  92.       SwpPath := SwpPath + '\';
  93.     End;
  94.   End;
  95. End;
  96.  
  97. Procedure CheckError(Error : TSRError);
  98. Begin
  99.  Case Error of
  100.   DiskSpaceShortage : Writeln('Not enough disk space');
  101.   Installed         : Writeln(HelpName+' is allready installed');
  102.   Ok                : Begin
  103.                        HotKeys;
  104.                        Exit;
  105.                       End;
  106.  End;
  107.  
  108.  Halt(1);
  109. End;
  110.  
  111.  
  112.  
  113. End.